package org.xdq.demo.base;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Configuration;

@Configuration //Spring配置类，作用等同于xml形式的配置文件，配置类本身也会被放入spring容器中
public class CommonBaseConfig {

    private static ApplicationContext ctx;//spring容器（spring上下文）

    @Autowired //spring上下文也在容器中
    public void setCtx(ApplicationContext ctx) {
        CommonBaseConfig.ctx = ctx;
    }

    public static ApplicationContext applicationContext() {
        return ctx;
    }
}
